import {query} from  '../services/user';
export default {
    namespace: 'user',
    state: {
        list: []
    },
    reducers: {
        getList(state,action){
            // return新的state状态数据
            return {...state,list:action.data}
        },
        add(state,action){

        },
        del(state,action){

        }
    },
    effects: {
        *getListAsync(action,{call,put}){
            // console.log('getListAsync');
            const {data}=yield call(query);
            // 通过put触发action
            yield put({type:'getList',data:data.data});
        }
    },
    subscriptions: {

    }
}